import routes
from zhwsgi import wsgi
from zhwsgi import versions

class API(wsgi.Router):

    def __init__(self, mapper = None):
        if mapper == None:
            mapper = routes.Mapper()

        versions_resource = versions.create_resource()
        mapper.connect('indexroute', '/index', controller=versions_resource, action='index')
        mapper.connect('deafultroute', '/{filename:.*?}', controller=versions_resource, action='default')

        super(API, self).__init__(mapper)
